home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7061 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: sparky.navsea.navy.mil!matuli_a
  2. From: matuli_a@marlin.navsea.navy.mil (Alex Matulich 03T1 602-6691)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Messages vs. Semaphores for external clocking
  5. Date: 8 Apr 1996 14:02:42 GMT
  6. Organization: Naval Sea Systems Command Code 03T1
  7. Message-ID: <4kb6a2$cal@sparky.navsea.navy.mil>
  8. References: <4ju349$r1e@sparky.navsea.navy.mil> <4jvrqs$hk0@btmpjg.god.bel.alcatel.be> <slN3BCS00iWZ0_8G1R@andrew.cmu.edu> <316533DF.5BFD@bat710.univ-lyon1.fr>
  9. NNTP-Posting-Host: marlin.navsea.navy.mil
  10.  
  11. Laurent GIROUD  <milu28@bat710.univ-lyon1.fr> wrote:
  12. }> > Use global data, which your subtask fills with the timer-values,
  13. }> > and the parent process reads. Disable() and Enable() multitasking
  14.  
  15. }> This is very, very bad advice. A message port or a semaphore is indeed
  16. }> needed. Disable()/Enable() are bad programming styles, especially for
  17.  
  18. }   Of course but you must not forget something -> in order to be sure
  19. }that the semaphore you are just refering to in your program is valid
  20. }you actually HAVE to FindName() it before and then to acces it in an
  21. }atomic operation thus needing to embrace the two instructions (FindName
  22. }+ ObtainSemaphore) in a Forbid()/Permit() pair...
  23.  
  24. Now, I didn't know this.  I thought FindName() was something I had to do
  25. only once, and thereafter I could access the semaphore whenever I pleased,
  26. locking it and unlocking it as needed.
  27.  
  28. Other people's suggestion to use a double-buffered semaphore sounds
  29. interesting, and might increase eficciency.
  30.  
  31. -- 
  32.                                            /|
  33. Alex Matulich                      __.  __=#||  ___   _o--
  34. matuli_a@marlin.navsea.navy.mil ____##_/_____|==###===###____
  35.                                 \____________________________\
  36.